using System;
using System.Collections.Generic;
using System.Text;

using Peradigm.Framework.Domain.Security;
using Peradigm.Framework.Persistence;

namespace Liberty.Domain.Kernel
{

    [Serializable]
    public class Task : PersistentModel
    {
        #region Constants
        #endregion

        #region Event Handlers
        #endregion

        #region Methods
        /// <summary>
        /// Creates a stubbed task populated with frequently used primitives.
        /// Other aggregated objects are not populated by this factory method.
        /// </summary>
        /// <returns></returns>
        public static Task TestInstance()
        {
            Task stub = new Task();
            stub.CompletedOn = new DateTime( 2006, 5, 4 );
            stub.DueOn = new DateTime( 2006, 5, 5 );
            stub.LongDescription = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam pretium luctus orci. Maecenas nonummy semper tellus. Etiam lobortis erat quis ante. Pellentesque placerat aliquet ligula. Sed nunc. Aliquam quis purus. Ut a mi. Aenean id ligula ut libero auctor fringilla. Aliquam erat volutpat. Praesent a pede non justo mollis consectetuer.";
            stub.Oid = 12L;
            stub.RemindOn = new DateTime( 2006, 5, 4 );
            stub.ShortDescription = "Etiam pretium luctus orci";

            return stub;
        }

        public void MakeComplete( DateTime completedOn, User completedBy )
        {
            this.CompletedOn = completedOn;
            this.CompletedBy = completedBy;
        }
        #endregion

        #region Properties
        public DateTime? CompletedOn
        {
            get
            {
                return i_CompletedOn;
            }
            set
            {
                i_CompletedOn = value;
            }
        }

        

        public User CompletedBy
        {
            get { return i_CompletedBy; }
            set { i_CompletedBy = value; }
        }

        public bool IsComplete
        {
            get
            {
                return this.CompletedOn.HasValue;
            }
        }

        public DateTime? DueOn
        {
            get
            {
                return i_DueOn;
            }
            set
            {
                i_DueOn = value;
            }
        }

        public string LongDescription
        {
            get
            {
                return i_LongDescription;
            }
            set
            {
                i_LongDescription = value;
            }
        }

        public DateTime? RemindOn
        {
            get
            {
                return i_RemindOn;
            }
            set
            {
                i_RemindOn = value;
            }
        }

        public string ShortDescription
        {
            get
            {
                return i_ShortDescription;
            }
            set
            {
                i_ShortDescription = value;
            }
        }
        #endregion

        #region Private Methods
        #endregion

        #region Private Properties
        #endregion

        #region Construction and Finalization
        public Task()
        {
        }
        #endregion

        #region Data Elements
        private DateTime? i_CompletedOn;
        private DateTime? i_DueOn;
        private string i_LongDescription;
        private DateTime? i_RemindOn;
        private string i_ShortDescription;
        private User i_CompletedBy;
        #endregion
    }
}